import queryDashboardData from '@/services/dashboard';

export default {
  namespace: 'dashboard',

  state: {
    smsChartData: [],
    appChartData: [],
    smsFailureRatio: [],
    todaySmsVo: {},
    appSmsLoginList: [],
    smsReceiveSuccessChartData: [],
    smsReceiveFailureRatio: [],
  },

  effects: {
    *fetch({ payload }, { call, put }) {
      const { data } = yield call(queryDashboardData, payload);
      yield put({
        type: 'save',
        payload: { ...data },
      });
    },
  },

  reducers: {
    save(state, { payload }) {
      return {
        ...state,
        ...payload,
      };
    },
  },
};
